<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<style>
.pageFormContent p {width:98%;}
.pageFormContent p label{width: 90px;}
.pageFormContent p .sp{padding: 2px; line-height: 20px; color:#aaa;}
span.error{left: 300px; width: 100px;}
</style>
<script type="text/javascript">
	$(document).ready(function(){
		$("#sendBillSelProId").change(function(){
			var $this = $(this);
			if($this.val()== ""){
				$("#sendBillBrId option").not(":first").remove();
			}else{
				var txt = $("#sp_send_bill").text(), proId = $this.val();
				if($.trim(txt) != ""){
					$("#sendBillBrId option").not(":first").remove();
					var selJson = $.parseJSON(txt);
					$.each(selJson, function(i){
						var key2 = 'pro_'+proId;
						if(i == key2){ 
							$.each(selJson[i], function(j){
								$("#sendBillBrId").append('<option value="'+selJson[i][j].id+'">'+selJson[i][j].brandName+'</option>');
							});
						}
					});
				}
			}
		});
	});
	
	function subExcelForm(){
		var f = $("#excelForm");
		var tp = $("#customer_type").val();
		if(tp == 1){
			f.attr("action", "saveSendExcelOfBill?callbackType=closeCurrent");
		}else if(tp==0){
			f.attr("action", "saveSignExcelOfBill?callbackType=closeCurrent");
		}
		f.submit();
	}
</script>
<div class="pageContent">
	<form method="post" id="excelForm" enctype="multipart/form-data" action="" class="pageForm required-validate" onsubmit="return iframeCallback(this, dialogAjaxDone);">
		<div class="pageFormContent" layoutH="58">
			<p>
				<label>客 户：</label>
				<select class="required combox" name="customerId">
					<option value="">-选择客户-</option>
					<c:forEach var="cu" items="${customerList }">
						<option value="${cu.id }">${cu.customerName}</option>
					</c:forEach>
				</select>
				<span class="sp"><font style="color:#f00;">*</font> 没有客户数据, 需新增</span>
			</p>
			<p>
				<label>子活动名称：</label>
				<input type="text" name="activtySonName" value="" size="24" readonly="readonly" />
				<a class="btnLook" maxable="false" href="showSonActivity"   lookupGroup="" >查找带回</a>
				<input type="hidden" size="16" readonly="readonly" class="required" name="activtySonId" value=""  />
				<input type="hidden" size="16" readonly="readonly"  name="activtyId" value=""  />
			</p>
			<p>
			   <label>品 名: </label>
				<select name="sysProductId" id="sendBillSelProId"  class="required" style="width:185px;">
					<option value="">-选择品名-</option>
					<c:forEach var="pro" items="${productList }">
						<option value="${pro.id }">${pro.productName }</option>
					</c:forEach>
				</select>
				<span class="sp"><font style="color:#f00;">*</font> 如果没有品名, 需新增</span>
			</p>
			<p>
				<label>品 牌: </label>
				<select name="brandId" id="sendBillBrId" class="required" style="width: 185px;">
					<option value="" selected="selected">-选择品牌-</option>
				</select>
				<span class="sp"><font style="color:#f00;">*</font> 如果没有品牌, 需新增</span>
			</p>
			<p>
				<label>清单Excel：</label>
				<input name="excelFile" type="file" size="22" readonly="readonly" class="required"/>
			</p>
		 
			<p>
				<span style="color:#f00; line-height: 24px;font-size:14px;">(1) 文件格式:  xls , xlsx; <br>(2) 上传产品清单Excel前, 请仔细核对格式!
				 
				</span>
			</p>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="button" onclick="subExcelForm();">保存</button></div></div>
					<span id="sp_send_bill" style="display: none;">${brandOfProductJson }</span>
					<input type="hidden" name="customer_t" id="customer_type" value="${customerType }" />
				</li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>
